/*
 * @file: main.c
 * @brief: main函数和ctrl+c的处理函数
 * @author: 廖文雄 
 * @date: 2019.10.30
 * @note: 
 */
#include <stdio.h>
#include <setjmp.h>

#include "app.h"

jmp_buf ctrl_c_jump;

int main(int argc, char *argv[])
{
    int ret = 0;

    ret = setjmp(ctrl_c_jump);
    if (ret != 1) {
        init(argc, argv);

        run();
    }

    destroy();

    return 0;
}

/*Ctrl+C触发信号处理函数*/
void ctrl_c_handle(int sig)
{
	printf("\n\tpress Ctrl+C and exit\n");
    
	longjmp(ctrl_c_jump, 1);
}